<?php
class Zendvn_View_Helper_AdminToolbarButton extends Zend_View_Helper_Abstract{
	
	public function adminToolbarButton($name,$value = '#',$attribs = null,$options = null ){
		$view= $this->view;
		if ($options['divider'] !== "divider"){
			
		
		$name = $view->translate($options['name']);
		if($needCheck = $options['needCheck'] == 1) $needCheckMsg = $view->translate($options['needCheckMsg']); else{
			$needCheckMsg = " ";
			$needCheck = 0;
		}
		if($needConfirm = $options['needConfirm'] == 1) $needConfirmMsg = $view->translate($options['needConfirmMsg']);else {
			$needConfirmMsg =" ";
			$needConfirm = 0;
		}
		
		$classIcon = $options['iconClass'];
		if(empty($classIcon)) $classIcon = 'icon-32-default';
		$link=$value;
		if($options['buttonType'] == 'submit'){
			$link = "javascript:toolbarButtonSubmit('" .  $link . "','".$needCheck."','".$needCheckMsg."','".$needConfirm."','".$needConfirmMsg."')";
		}
		
		$xhtml = '<li class="button" id="toolbar-'.$name.'">
                    <a href="' . $link . '" class="toolbar">
                    	<span class="'.$classIcon.'"></span>
                        ' . $name . '
                    </a>
                  </li>';
		}else
			$xhtml = '<li class="divider" ></li>';
		return $xhtml;
	}
}